/*
 * Created on 2007-9-10
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.tongji.quickCRUDQ.dao.id;

import java.util.List;
import java.util.Map;

import com.tongji.quickCRUDQ.dao.jdbc.CommonDao;

/**
 * @author Administrator
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class IdGeneratorOracle implements IdGenerator {
	private CommonDao commonDao;

	/* (non-Javadoc)
	 * @see com.tongji.quickCRUDQ.dao.id.IdGenerator#generator(java.lang.Object)
	 */
	public synchronized String generator(Object obj) {
		String sql="select get_seq() id from dual";
		List list=commonDao.select(sql);
		Map map=(Map)list.get(0);
		String id=(String) map.get("ID");
		return id;
	}

	/**
	 * @return Returns the commonDao.
	 */
	public CommonDao getCommonDao() {
		return commonDao;
	}
	/**
	 * @param commonDao The commonDao to set.
	 */
	public void setCommonDao(CommonDao commonDao) {
		this.commonDao = commonDao;
	}
}
